// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ------------------------------------------------------------------
// Modification history:
// feature: Code style modification
// ------------------------------------------------------------------

#ifndef INCLUDE_ERTPS_ERTPS_DLL_H_
#define INCLUDE_ERTPS_ERTPS_DLL_H_

#include <ertps/config.h>

// normalize macros
#if !defined(ERTPS_DYN_LINK) && !defined(ERTPS_STATIC_LINK) && !defined(VBS_ALL_DYN_LINK) && \
    !defined(VBS_ALL_STATIC_LINK)
#define ERTPS_STATIC_LINK
#endif

#if defined(VBS_ALL_DYN_LINK) && !defined(ERTPS_DYN_LINK)
#define ERTPS_DYN_LINK
#endif

#if defined(ERTPS_DYN_LINK) && defined(ERTPS_STATIC_LINK)
#error Must not define both ERTPS_DYN_LINK and ERTPS_STATIC_LINK
#endif

#if defined(VBS_ALL_NO_LIB) && !defined(ERTPS_NO_LIB)
#define ERTPS_NO_LIB
#endif

// enable dynamic linking

#if defined(_WIN32)
#if defined(VBS_ALL_DYN_LINK) || defined(ERTPS_DYN_LINK)
#if defined(ertpsEXPORTS)
#define RTPS_DllAPI __declspec(dllexport)
#else
#define RTPS_DllAPI __declspec(dllimport)
#endif  // ERTPS_SOURCE
#else
#define RTPS_DllAPI
#endif
#else
#define RTPS_DllAPI
#endif  // _WIN32

// Auto linking.

#if !defined(ERTPS_SOURCE) && !defined(VBS_ALL_NO_LIB) && !defined(ERTPS_NO_LIB)

// Set properties.
#define VBS_LIB_NAME ertps

#if defined(VBS_ALL_DYN_LINK) || defined(ERTPS_DYN_LINK)
#define VBS_DYN_LINK
#endif

#include <ertps/vbs_auto_link.h>
#endif  // auto-linking disabled

#endif  // INCLUDE_ERTPS_ERTPS_DLL_H_
